package com.example.demo.controller;

import java.net.InetAddress;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//自动装配原理
@RestController
public class Home {
	// 接口：http://localhost:8080/hello
	@RequestMapping("/Home")
	public String Home() {
		try {
			InetAddress address = InetAddress.getLocalHost();
			String hostname = address.getHostName();
			return hostname + "\n";
		} catch (Exception e) {
			e.printStackTrace();
			return "sys error !!!";
		}
	}
}